package com.knight.hadoop.day08.flow;

import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;

import org.apache.hadoop.io.Writable;

public class FlowModel implements Writable{
	
	private Long upFlow;//上行流量
	private Long dwFlow;//下行流量
	
	
	
	public FlowModel() {}

	@Override
	public String toString() {
		return "upFlow=" + upFlow + "\t dwFlow=" + dwFlow + "\t sumFlow="+(upFlow+dwFlow);
	}

	public FlowModel(Long upFlow, Long dwFlow) {
		this.upFlow = upFlow;
		this.dwFlow = dwFlow;
	}
	
	public Long getUpFlow() {
		return upFlow;
	}
	public void setUpFlow(Long upFlow) {
		this.upFlow = upFlow;
	}
	public Long getDwFlow() {
		return dwFlow;
	}
	public void setDwFlow(Long dwFlow) {
		this.dwFlow = dwFlow;
	}

	@Override
	public void write(DataOutput out) throws IOException {
		out.writeLong(upFlow);
		out.writeLong(dwFlow);
	}

	@Override
	public void readFields(DataInput in) throws IOException {
		upFlow = in.readLong();
		dwFlow = in.readLong();
	}

}
